﻿@model AdminSettingsViewModel

@{ Layout = "~/Views/Shared/Layout.cshtml"; }

@this.Html.RenderMessage()

<div class="sitePath">
	<a href="@this.Url.Action("Edit")" title="@this.Model.PageDescription" >@this.Model.PageName</a> 
</div>

@using(this.Html.BeginForm())
{
	<div class="adminSettings">
		<h1>@Resources.AdminAccountSettings</h1>
		<div>
			<span>@Resources.UserName:</span><input type="text" name="userName" maxlength="@AdminSettings.MaxUserNameLength" value="@this.Model.UserName" class="@(this.Model.IsUserNameValid ? "" : "errorInput")" />
		</div>
		<div>
			<span>@Resources.Email:</span><input type="text" name="email" maxlength="@AdminSettings.MaxEmailLength" value="@this.Model.Email" class="@(this.Model.IsEmailValid ? "" : "errorInput")" />
		</div>
		<div>
			<span>@Resources.Password:</span><input type="password" name="password" maxlength="@AdminSettings.MaxPasswordLength" value="@this.Model.Password" class="@(this.Model.IsPasswordValid ? "" : "errorInput")" />
		</div>
		<div>
			<span>@Resources.RepeatPassword:</span><input type="password" name="repeatedPassword" maxlength="@AdminSettings.MaxPasswordLength" value="@this.Model.RepeatedPassword" class="@(this.Model.IsRepeatedPasswordValid ? "" : "errorInput")" />
		</div>
		<div>
			<button class="linkButton" title="@Resources.SaveSettings" type="submit">@Resources.Save</button>
		</div>
	</div>
}

@if(this.Model.AuthorInfo != null)
{ 
	using (this.Html.BeginForm("EditAuthorInfo", "Admin"))
	{
		<div class="adminSettings">
			<h1>@Resources.AuthorSettings</h1>
			<div>
				<span>@Resources.AuthorName:</span><input type="text" name="authorName" maxlength="@AuthorInfo.MaxNameLength" value="@this.Model.AuthorInfo.Name" class="@(this.Model.AuthorInfo.IsNameValid ? "" : "errorInput")" />
			</div>
			<div>
				<span>@Resources.AuthorDescription:</span><textarea rows="3" cols="1" name="authorDescription" class="@(this.Model.AuthorInfo.IsDescriptionValid ? "" : "errorInput")">@this.Model.AuthorInfo.Description</textarea>
			</div>

			<div>
				<span>@Resources.ImageUri:</span><input type="text" name="authorImageUri" maxlength="@AuthorInfo.MaxImageUriLength" value="@this.Model.AuthorInfo.ImageUri" class="@(this.Model.AuthorInfo.IsImageUriValid ? "" : "errorInput")" />
			</div>

			<div>
				<span>@Resources.SocialNetwork:</span><input type="text" name="authorSocialNetwork" maxlength="@AuthorInfo.MaxSocialNetworkLength" value="@this.Model.AuthorInfo.SocialNetwork" class="@(this.Model.AuthorInfo.IsSocialNetworkValid ? "" : "errorInput")" />
			</div>

			<div>
				<span>@Resources.CustomScript:</span><textarea rows="5" cols="1" name="authorCustomScript" class="@(this.Model.AuthorInfo.IsCustomScriptValid ? "" : "errorInput")">@this.Model.AuthorInfo.CustomScript</textarea>
			</div>

			<div>
				<button class="linkButton" title="@Resources.SaveSettings" type="submit">@Resources.Save</button>
			</div>
		</div>
	}
}
